You can prepare in advance to recover the database of DB instance in case of failure. You can perform backups through the web console whenever necessary, and you can configure to perform backups periodically. During backup, storage performance of the DB instance on which the backup is performed can be degraded. To avoid affecting service, it is better to perform back up at a time when the service is under low load. If you do not want the backup to degrade performance, you can use a high-availability configuration or perform backups from read replica.
[Note] High availability DB instances are backed up on the extra master without compromising the master's storage performance.
The following settings are applied to backup, and also to auto and manual backups.
Use Table Lock
FLUSH TABLES WITH READ LOCK
ets whether the syntax is enabled or disabled.FLUSH TABLES WITH READ LOCK
syntax periodically during backups to ensure consistency in backup data. If FLUSH TABLES WITH READ LOCK
syntax fails to run, the backup will fail.FLUSH TABLES WITH READ LOCK
syntax will not run, so a high DML load does not cause the backup to fail. However, backups without table lock may not ensure consistency of backup data, and as a result, some operations, including restore and replication processes, are not supported for backups created without table lock and for DB instances with table locking disabled.Query Latency Dash Time (second)
FLUSH TABLES WITH READ LOCK
syntax. FLUSH TABLES WITH READ LOCK
syntax will wait for the query latency dash time. It can be set from 0 to 21,600 seconds. Longer settings reduce the likelihood of backup failures due to DML query load, but may result in longer overall backup times.If you need to permanently store databases at a certain point in time, you can perform backups manually from the web console. Unlike auto backups, manual backups are not deleted, unless you explicitly delete the backup, as they are when DB instance is deleted Manual backups require you to enter a name for the backup and have the following limitations.
In addition to manually performing backups, auto backups can occur when needed for restore operations or based on auto backup schedule settings. Auto backups have the same lifecycle as DB instances. When a DB instance is deleted, all archived auto backups are deleted. The following setting items are supported by auto backups.
Allow Auto Backup
Auto Backup Retention Period
Auto Backup Replication Region
Number of Auto Backup Retries
Use Auto Backup Schedule
Auto Backup Run Time
Auto backup name is given in the format of {DB instance name} yyyy-MM-dd-HH-mm
.
[Caution] Backups may not be performed in some situations, such as when a previous backup fails to terminate.
All backup files are uploaded to the internal object storage and stored. For manual backups, they are stored permanently until you delete them separately, and object storage charges are incurred depending on the backup capacity. For automatic backups, it is stored for the set retention period and charges for the full size of the automatic backup file, which exceeds the storage size of the DB instance. If you do not have direct access to the internal object storage where the backup file is stored, and when you need backup file, you can export the backup file to the object storage in NHN Cloud.
You can export backup files stored on internal object storage to user object storage on NHN Cloud. You can also export a manual or automatic backup file, or export the backup file to user object storage at the same time as you perform the backup. While exporting backups, network performance of the source DB instance may degrade.
[Note] For manual backups, if the source DB instance that performed the backup was deleted, you cannot export the backup.
Backups allow you to restore data to any point in time. Restoration always creates new DB instance and cannot be restored to the existing DB instance. You can restore only to the same DB engine version as the source DB instance from which you performed the backup. Supports restoring snapshots to the point in time when the backup was created, and restoring point in time to a specific point in time. You can restore it as backup of external MariaDB as well as backup that you created in RDS for MariaDB.
[Caution] Restoration might fail if the storage size of the DB instance that you want to restore is smaller than the storage size of the source DB instance that you backed up, or if you use a different parameter group than the parameter group of the source DB instance.
Restoring a backup to a point in time is called snapshot restoration. Restoration is done with only backup files, you do not need the source DB instance from which you performed the backup.
Restoring to a particular point in time is called point-in-time restoration. You can restore to a specific position in the binary log, as well as to restore to a specific time. Point-in-time restoration requires backup file and binary log from the time you performed the backup to the time you wanted the restore. Binary logs are stored in the storage of the source DB instance where the backup is performed. Shorter binary log retention period allows you to use more storage capacity, but it may be difficult to restore to the desired point in time. For the cases listed below, you may not be able to restore to the desired point in time because there is no binary log required for point-in-time restoration.
You can use an external MariaDB backup file to create a DB instance. When creating an external MariaDB backup file, refer to Backup and use the same version as the Percona XtraBackup used by RDS for MariaDB.
[Caution] If the setting value of innodb_data_file_path is not ibdata1:12M:autoextend, it is unable to restore to DB instance of RDS for MariaDB.
(1) Use the command below to perform a backup on the server where MariaDB is installed.
mariabackup --defaults-file={my.cnf 경로} --user {사용자} --password '{비밀번호}' --socket {MariaDB 소켓 파일 경로} --compress --compress-threads=1 --stream=xbstream {백업 파일이 생성될 디렉터리} 2>>{백업 로그 파일 경로} > {백업 파일 경로}
(2) Check that completed OK!
is in the last line of the backup log file. If there is no completed OK!
, the backup did not end successfully, so refer to the error message in the log file to proceed with the backup again.
(3) Upload the completed backup file to the object storage.
(4) After accessing the web console of the project you want to restore, on the DB Instances tab, click the Restore to Backup in Object Storage button.
You can use the backup file in RDS for MariaDB to restore the database in MariaDB directly. When restoring a RDS for MariaDB backup file, refer to the Backup and use the same version as Percona XtraBackup used by RDS for MariaDB.
(1) Export backup of RDS for MariaDB to object storage with reference to the Export Backup.
(2) Download the backup of the object storage to the server on which you want to restore it.
(3) Stop the MariaDB service.
(4) Delete all files in the MariaDB data storage path.
rm -rf {MariaDB data storage path}/*
(5) Unzip and restore the downloaded backup files.
cat {백업 파일 저장 경로} | xbstream -x -C {MariaDB 데이터 저장 경로}
mariabackup --decompress {MariaDB 데이터 저장 경로}
mariabackup --defaults-file={my.cnf 경로} --apply-log {MariaDB 데이터 저장 경로}
(6) Delete unnecessary files after unzipping files.
find {MariaDB data storage path } -name "*.qp" -print0 | xargs -0 rm
(7) Start MariaDB service.